package com.ship.system.api;

import com.ship.common.core.web.domain.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.ship.common.core.constant.SecurityConstants;
import com.ship.common.core.constant.ServiceNameConstants;
import com.ship.common.core.domain.R;
import com.ship.system.api.domain.SysUser;
import com.ship.system.api.factory.RemoteUserFallbackFactory;
import com.ship.system.api.model.LoginUser;

import java.util.List;

/**
 * 用户服务
 * 
 * @author zhangyh
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/public/user/info/{username}")
    public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param sysUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/public/user/register")
    public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据用户id查询用户是否有对应权限
     */
    @GetMapping("/systemFeign/menu/count")
    public int getUserMenuCount(@RequestParam("userId") Long userId,@RequestParam("menuPerm") String menuPerm);

    /**
     * 获取用户信息
     */
    @GetMapping("/public/systemFeign/sys/userlist")
    public List<SysUser> getUserListInfo();

    @GetMapping("/public/systemFeign/getUserByName")
    public SysUser getUserByName(@RequestParam("userName") String userName);

    @GetMapping("/public/systemFeign/listByIds")
    List<SysUser> listByIds(@RequestParam("assigeners") String assigeners);
}
